import 'package:flutter/material.dart';
import 'package:jiajia_diy/diyProject/diy.dart';

class DiyDetailsContent extends StatelessWidget {
  DiyDetailsContent(this.diyItem);
  Diy diyItem;
  final _biggerFont = new TextStyle(fontSize: 16.0);
  @override
  Widget build(BuildContext context) {
    //container封装，用于展示diy详情的信息
    Widget _textContainer(Color color, String text, [font]) {
      return new Container(
        padding: const EdgeInsets.fromLTRB(8.0, 5.0, 0.0, 5.0),
        decoration: new BoxDecoration(
          color: color,
          border: new Border(
              bottom: new BorderSide(color: Colors.grey[100])),
        ),
        child: new Text(
          text,
          style: _biggerFont,
        ),
      );
    }

    //返回一个容器包含diy详情的listview
    return new Container(
      color: Colors.grey[200],
      child: new ListView(
        children: <Widget>[
          _textContainer(Colors.grey[200], '基本信息'),
          _textContainer(Colors.white, '活动名称：${diyItem.name}'),
          _textContainer(Colors.white, '活动地点：${diyItem.place}'),
          _textContainer(Colors.white, '活动时间：${diyItem.date}'),
          _textContainer(Colors.white, '联系人：${diyItem.leader}'),
          new Padding(
              padding: const EdgeInsets.only(top: 10.0),
              child: _textContainer(Colors.grey[200], '金额开支')),
          _textContainer(Colors.white, '活动总价：${diyItem.price}'),
          _textContainer(Colors.white, '物料成本：${diyItem.itemCost}'),
          _textContainer(Colors.white, '人力成本：${diyItem.laborCost}'),
          _textContainer(Colors.white, '净得利润：${diyItem.profit}'),
        ],
      ),
    );
  }
}
